<?php


namespace app\system\controller;

class My extends AdminBase
{
	public function revise_password()
	{
		$options = $this->request->post();
		$validate = \think\Validate::make(["password" => "require", "new_password" => "require"], ["password.require" => "原密码不能为空！", "new_password.require" => "新密码不能为空！"]);
		if (!$validate->check($options)) {
			$this->response(\app\system\model\Code::fail, $validate->getError());
		}
		$options["id"] = $this->admin_info["id"];
		$result = \app\system\service\MyService::revise_password($options);
		if ($result["code"] == 1) {
			$this->response($result["code"], "修改密码成功");
		} else {
			$this->response($result["code"], $result["msg"]);
		}
	}
}